package com.aspose.cells;

import java.io.OutputStream;

public class WorkbookRender {
   private Workbook a;
   private ImageOrPrintOptions b;
   private zbuz c;
   private int d = 0;
   private int e = 0;

   public int getPageCount() {
      return this.e;
   }

   public WorkbookRender(Workbook workbook, ImageOrPrintOptions options) throws Exception {
      this.a = workbook;
      this.b = options;
      this.c = new zbuz(this.a);
      this.c.a = new com.aspose.cells.a.d.zat();
      if (this.b.getImageFormat() != ImageFormat.getTiff() && this.b.getSaveFormat() == 0) {
         this.b.setSaveFormat(20);
      }

      this.c.a(this.b);
      if (this.c.c != null) {
         this.e = this.c.c.size();
      }

   }

   void a(com.aspose.cells.b.a.d.zm var1) throws Exception {
      if (this.b.getImageFormat() != ImageFormat.getTiff() && this.b.getSaveFormat() != 21 && this.b.getSaveFormat() != 20) {
         throw new CellsException(19, "WorkbookRender only support Tiff/XPS");
      } else if (var1 != null) {
         this.c.a(var1, this.b);
      }
   }

   public void toImage(OutputStream stream) throws Exception {
      if (this.b.getImageFormat() != ImageFormat.getTiff() && this.b.getSaveFormat() != 21 && this.b.getSaveFormat() != 20) {
         throw new CellsException(19, "WorkbookRender only support Tiff/XPS");
      } else if (stream != null) {
         com.aspose.cells.b.a.d.zj var2 = new com.aspose.cells.b.a.d.zj(stream);
         this.c.a((com.aspose.cells.b.a.d.zm)var2, this.b);
      }
   }

   public void toImage(String filename) throws Exception {
      if (this.b.getImageFormat() != ImageFormat.getTiff() && this.b.getSaveFormat() != 21 && this.b.getSaveFormat() != 20) {
         throw new CellsException(19, "WorkbookRender only support Tiff/XPS");
      } else {
         com.aspose.cells.b.a.d.ze var2 = new com.aspose.cells.b.a.d.ze(filename, 2);
         this.c.a((com.aspose.cells.b.a.d.zm)var2, this.b);
         var2.a();
      }
   }

   public void toPrinter(String PrinterName) throws Exception {
      this.c.g = true;
      zho var2 = new zho(PrinterName, this.c);
      var2.a();
   }

   public void toPrinter(String PrinterName, String JobName) throws Exception {
      this.c.g = true;
      zho var3 = new zho(PrinterName, JobName, this.c);
      var3.a();
   }
}
